home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-07-28 | 2.2 KB | 98 lines | [TEXT/KAHL] |
- /*
- File: StatusWindow.cp
-
- Copyright: © 1991-1994 by Apple Computer, Inc.
- All rights reserved.
-
- Part of the AOCE Sample SMSAM Package. Consult the license
- which came with this software for your specific legal rights.
-
- */
-
-
-
- #ifndef __BLJSTANDARDINCLUDES__
- #include "BLJStandardIncludes.h"
- #endif
-
- #ifndef __STATUSWINDOW__
- #include "StatusWindow.h"
- #endif
-
- #ifndef __PASCALSTRING__
- #include "PascalString.h"
- #endif
-
- #ifndef __BOVINESERVER__
- #include "BovineServer.h"
- #endif
-
- /***********************************|****************************************/
-
- TStatusWindow::TStatusWindow ( short dialogID, short stringsSTRPoundID, GetLoadIndicatorFunc loadIndicatorFunc ) :
- TDialogWindow ( dialogID, stringsSTRPoundID )
- {
- fGetLoadIndicatorValueFunc = loadIndicatorFunc;
- }
-
- /***********************************|****************************************/
-
- TStatusWindow::~TStatusWindow ( )
- {
- }
-
- /***********************************|****************************************/
-
- void TStatusWindow::HandleButtonPress ( short whichButton )
- {
- switch ( whichButton )
- {
- case 1: // "Pause/Resume" button
- SetGatewayPausing ( ! IsGatewayPausing ( ) );
- break;
- }
- }
-
- /***********************************|****************************************/
-
- Boolean TStatusWindow::UpdateLoadIndicator ( )
- {
- SetPort ( fDialogWindow );
- DrawUserItem ( 1 );
-
- return true;
- }
-
- /***********************************|****************************************/
-
- void TStatusWindow::DrawUserItem ( short whichItem )
- {
- if ( whichItem == 1 )
- {
- unsigned long loadIndicator = (fGetLoadIndicatorValueFunc) ( );
-
- if ( loadIndicator < 0 )
- loadIndicator = 0;
- else if ( loadIndicator > 100 )
- loadIndicator = 100;
-
- Rect totalRect = fUserItemRect [ whichItem ];
- Rect filledRect = totalRect;
- Rect emptyRect = totalRect;
-
- PenNormal();
-
- filledRect.right = (short) ( ( filledRect.right - filledRect.left ) * loadIndicator ) / 100 + filledRect.left;
- FillRect ( & filledRect, (ConstPatternParam) & qd.black );
-
- emptyRect.left = filledRect.right;
- FrameRect ( & emptyRect );
-
- InsetRect ( & emptyRect, 1, 1 );
- FillRect ( & emptyRect, (ConstPatternParam) & qd.white );
- }
- }
-
- /***********************************|****************************************/
-
-